package com.itheima.dao;

import com.itheima.pojo.Member;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface MemberMapper {
    @Select("SELECT * FROM t_member where phoneNumber = #{telephone}")
    Member findBytelephone(@Param("telephone") String telephone);

    void add(Member member);

    Integer getMemberReport(String month);

    @Select("SELECT * FROM t_member where id in (SELECT mf.family_member_id FROM t_member mb,t_member_family mf where mb.id=mf.member_id and mb.id = #{id}) or id =#{id}")
    List<Member> getFamily(@Param("id") Integer id);

    @Select("select * from t_member where id = #{id}")
    Member getMemberById(Integer memberId);


    List<Map> getSex();

    List<Map> getAge();
}
